package com.war.dao.system;

import com.war.pojo.system.Buyer;
import com.war.pojo.system.Warehouse;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface BuyerDao {
    //查询顾客
    @Select("select * from sys_buyer")
    List<Buyer> selectAll();

    //查询顾客名称
    @Select("select name from sys_buyer")
    List<Buyer> selectName();

    //根据顾客名查顾客
    @Select("select * from sys_buyer where name=#{name}")
    Buyer selectByName(Buyer buyer);

    //根据id查顾客
    @Select("select * from sys_buyer where id=#{id}")
    Buyer selectById(Buyer buyer);

    //删除顾客
    @Delete("delete from sys_buyer where id=#{id}")
    int delWare(Buyer buyer);

    //修改顾客信息
    @Update("update sys_buyer set id=#{id}, name=#{name}, sex=#{sex}, tel=#{tel} where id=#{id}")
    int updateWare(Buyer buyer);

    //注册顾客
    @Insert("insert into sys_buyer(id, name, sex, tel) value(#{id}, #{name}, #{sex}, #{tel})")
    int addWare(Buyer buyer);

}
